
#include "ItemDesc.h"

ItemDesc::ItemDesc(){
	ativo = false;
	alphaVal = SDL_ALPHA_OPAQUE; //255
}

void ItemDesc::onRender(SDL_Surface* destSurface){
	if(ativo)
		Texto::onRender(destSurface);
}

void ItemDesc::onLoop(){
	
	if(!ativo)
		return;

	if(y > 400)
	{
		
		alphaVal -= 0.5f * CFPS::fpsControl.getSpeedFactor();
		
		y -= 1.5f * CFPS::fpsControl.getSpeedFactor();
		SDL_SetAlpha(getTextSurface(), SDL_SRCALPHA | SDL_RLEACCEL, (Uint8) alphaVal);
	}
	else
	{
		ativo = false;
		SDL_SetAlpha(getTextSurface(), SDL_SRCALPHA | SDL_RLEACCEL, SDL_ALPHA_OPAQUE);
		alphaVal = SDL_ALPHA_OPAQUE;
	}
}